<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.0">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.2/css/all.min.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.1.1/animate.min.css">

<script class="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"littlefxc.github.io","root":"/","images":"/images","scheme":"Mist","version":"8.2.2","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":false,"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}};
  </script>
<meta name="description" content="前言ab全称Apache HTTP server benchmarking tool的缩写，是Apache自带的网站benchmark测试工具。使用非常方便，简约而不简单。 官方网站：https:&#x2F;&#x2F;httpd.apache.org&#x2F;docs&#x2F;2.4&#x2F;programs&#x2F;ab.html  TIPS 可达到ab相同效果的工具：   wrk：https:&#x2F;&#x2F;github.com&#x2F;wg&#x2F;wrk   wrk">
<meta property="og:type" content="article">
<meta property="og:title" content="ab使用教程">
<meta property="og:url" content="http://littlefxc.github.io/2021/08/02/ab%E4%BD%BF%E7%94%A8%E6%95%99%E7%A8%8B/index.html">
<meta property="og:site_name" content="一年春又来">
<meta property="og:description" content="前言ab全称Apache HTTP server benchmarking tool的缩写，是Apache自带的网站benchmark测试工具。使用非常方便，简约而不简单。 官方网站：https:&#x2F;&#x2F;httpd.apache.org&#x2F;docs&#x2F;2.4&#x2F;programs&#x2F;ab.html  TIPS 可达到ab相同效果的工具：   wrk：https:&#x2F;&#x2F;github.com&#x2F;wg&#x2F;wrk   wrk">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2021-08-02T01:26:12.000Z">
<meta property="article:modified_time" content="2021-08-02T01:32:52.134Z">
<meta property="article:author" content="一年春又来">
<meta name="twitter:card" content="summary">


<link rel="canonical" href="http://littlefxc.github.io/2021/08/02/ab%E4%BD%BF%E7%94%A8%E6%95%99%E7%A8%8B/">


<script class="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>
<title>ab使用教程 | 一年春又来</title>
  




  <noscript>
  <style>
  body { margin-top: 2rem; }

  .use-motion .menu-item,
  .use-motion .sidebar,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header {
    visibility: visible;
  }

  .use-motion .header,
  .use-motion .site-brand-container .toggle,
  .use-motion .footer { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle,
  .use-motion .custom-logo-image {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line {
    transform: scaleX(1);
  }

  .search-pop-overlay, .sidebar-nav { display: none; }
  .sidebar-panel { display: block; }
  </style>
</noscript>

<link rel="alternate" href="/atom.xml" title="一年春又来" type="application/atom+xml">
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <h1 class="site-title">一年春又来</h1>
      <i class="logo-line"></i>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu">
        <li class="menu-item menu-item-home"><a href="/" rel="section"><i class="home                          //首页 fa-fw"></i>首页</a></li>
        <li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="archive          //归档 fa-fw"></i>归档</a></li>
        <li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="th           //分类 fa-fw"></i>分类</a></li>
        <li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="tags                     //标签 fa-fw"></i>标签</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</div>
        
  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>

  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%89%8D%E8%A8%80"><span class="nav-text">前言</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%AE%89%E8%A3%85"><span class="nav-text">安装</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#macOS"><span class="nav-text">macOS</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#CentOS-7"><span class="nav-text">CentOS 7</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Windows"><span class="nav-text">Windows</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E"><span class="nav-text">使用说明</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E7%A4%BA%E4%BE%8B"><span class="nav-text">示例</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%8A%A5%E8%A1%A8%E8%A7%A3%E8%AF%BB"><span class="nav-text">报表解读</span></a></li></ol></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">一年春又来</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap site-overview-item animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">234</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">38</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">125</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>



        </div>
      </div>
    </div>
  </aside>
  <div class="sidebar-dimmer"></div>


    </header>

    
  <div class="back-to-top" role="button">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://littlefxc.github.io/2021/08/02/ab%E4%BD%BF%E7%94%A8%E6%95%99%E7%A8%8B/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="一年春又来">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="一年春又来">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          ab使用教程
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>
      

      <time title="创建时间：2021-08-02 09:26:12 / 修改时间：09:32:52" itemprop="dateCreated datePublished" datetime="2021-08-02T09:26:12+08:00">2021-08-02</time>
    </span>

  
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <h1 id="前言"><a href="#前言" class="headerlink" title="前言"></a><strong>前言</strong></h1><p>ab全称Apache HTTP server benchmarking tool的缩写，是Apache自带的网站benchmark测试工具。使用非常方便，简约而不简单。</p>
<p>官方网站：<a target="_blank" rel="noopener" href="https://httpd.apache.org/docs/2.4/programs/ab.html">https://httpd.apache.org/docs/2.4/programs/ab.html</a></p>
<blockquote>
<p><strong>TIPS</strong></p>
<p>可达到ab相同效果的工具： </p>
<ul>
<li><p>wrk：<a target="_blank" rel="noopener" href="https://github.com/wg/wrk">https://github.com/wg/wrk</a> </p>
</li>
<li><p>wrk2：<a target="_blank" rel="noopener" href="https://github.com/giltene/wrk2">https://github.com/giltene/wrk2</a> </p>
</li>
<li><p>JMeter：<a target="_blank" rel="noopener" href="https://jmeter.apache.org/">https://jmeter.apache.org/</a> </p>
</li>
<li><p>Locust：<a target="_blank" rel="noopener" href="https://locust.io/">https://locust.io/</a></p>
</li>
</ul>
</blockquote>
<h2 id="安装"><a href="#安装" class="headerlink" title="安装"></a><strong>安装</strong></h2><h3 id="macOS"><a href="#macOS" class="headerlink" title="macOS"></a><strong>macOS</strong></h3><p>系统自带，直接使用即可。</p>
<h3 id="CentOS-7"><a href="#CentOS-7" class="headerlink" title="CentOS 7"></a><strong>CentOS 7</strong></h3><p>运行如下命令即可安装</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum -y install httpd-tools</span><br></pre></td></tr></table></figure>

<h3 id="Windows"><a href="#Windows" class="headerlink" title="Windows"></a><strong>Windows</strong></h3><ul>
<li>前往 <a target="_blank" rel="noopener" href="https://www.apachehaus.com/cgi-bin/download.plx">https://www.apachehaus.com/cgi-bin/download.plx</a> 下载ab安装包。</li>
<li>解压，将目录切换到安装包的bin目录，并在终端中执行如下命令即可</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">./ab xxxx</span><br></pre></td></tr></table></figure>

<blockquote>
<p><strong>TIPS</strong></p>
<p>由于笔者没有Windows环境，所以此步骤无法亲测。<br>亲们可百度 “Windows 安装 ab”，参照结果安装即可。资料非常丰富。</p>
</blockquote>
<h2 id="使用说明"><a href="#使用说明" class="headerlink" title="使用说明"></a><strong>使用说明</strong></h2><p>ab是一个命令行工具，使用说明如下：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br></pre></td><td class="code"><pre><span class="line">➜ ab -help</span><br><span class="line"></span><br><span class="line">Usage: ab [options] [http[s]://]hostname[:port]/path</span><br><span class="line"></span><br><span class="line">Options are:</span><br><span class="line"></span><br><span class="line">  -n requests   指定请求多少次</span><br><span class="line"></span><br><span class="line">  -c concurrency 指定并发数(指定同时发送几个请求)</span><br><span class="line"></span><br><span class="line">  -t timelimit  测试持续的最长时间，默认无限制，此参数隐含-n 50000</span><br><span class="line"></span><br><span class="line">  -s timeout   每个请求的超时时间，默认30秒</span><br><span class="line"></span><br><span class="line">  -b windowsize  指定TCP收发缓存大小，单位字节</span><br><span class="line"></span><br><span class="line">  -B address   指定在发起连接时绑定的IP地址</span><br><span class="line"></span><br><span class="line">  -p postfile   指定想要POST的文件，需和-T参数配合使用</span><br><span class="line"></span><br><span class="line">  -u putfile   指定想要PUT的文件，需和-T参数配合使用</span><br><span class="line"></span><br><span class="line">  -T content-type 指定POST/PUT文件时的Content-type。默认text/plain</span><br><span class="line"></span><br><span class="line">  -v verbosity  详细模式，打印更多日志</span><br><span class="line"></span><br><span class="line">  -w       将结果输出到html表格中</span><br><span class="line"></span><br><span class="line">  -i       使用HEAD方式代替GET发起请求</span><br><span class="line"></span><br><span class="line">  -x attributes  插入字符串作为table标签的属性</span><br><span class="line"></span><br><span class="line">  -y attributes  插入字符串作为tr标签的属性</span><br><span class="line"></span><br><span class="line">  -z attributes  插入字符串作为td或th标签的属性</span><br><span class="line"></span><br><span class="line">  -C attribute  添加Cookie，例如Apache=1234；可重复该参数选项以添加多个Cookie</span><br><span class="line"></span><br><span class="line">  -H attribute  添加任意的请求头，例如Accept-Encoding: gzip；可重复该参数选项以添加多个</span><br><span class="line"></span><br><span class="line">  -A attribute  添加Basic WWW认证信息，用户名和密码之间用:分隔</span><br><span class="line"></span><br><span class="line">  -P attribute  添加Basic Proxy认证信息，用户名和密码之间用:分隔</span><br><span class="line"></span><br><span class="line">  -X proxy:port  指定代理地址</span><br><span class="line"></span><br><span class="line">  -V       打印ab的版本信息</span><br><span class="line"></span><br><span class="line">  -k       使用HTTP的KeepAlive特性</span><br><span class="line"></span><br><span class="line">  -d       不显示百分比</span><br><span class="line"></span><br><span class="line">  -S       不显示预估和警告信息</span><br><span class="line"></span><br><span class="line">  -q       默认情况下，如果处理的请求数大于150，ab每处理大约10%或者100个请求时，打印一下进度信息。使用该参数后则不打印进度。</span><br><span class="line"></span><br><span class="line">  -g filename   输出结果信息到gnuplot格式的文件中</span><br><span class="line"></span><br><span class="line">  -e filename   输出结果信息到CSV格式的文件中</span><br><span class="line"></span><br><span class="line">  -r       指定接收到错误信息时不退出程序</span><br><span class="line"></span><br><span class="line">  -h       显示使用说明</span><br><span class="line"></span><br><span class="line">  -Z ciphersuite 指定SSL/TLS密码套件</span><br><span class="line"></span><br><span class="line">  -f protocol   指定SSL/TLS协议(SSL3, TLS1, TLS1.1, TLS1.2 or ALL)</span><br></pre></td></tr></table></figure>

<h2 id="示例"><a href="#示例" class="headerlink" title="示例"></a><strong>示例</strong></h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ab -c 100 -n 10000 http://www.baidu.com/</span><br></pre></td></tr></table></figure>

<p>表示并发100，请求baidu 10000次。</p>
<blockquote>
<p><strong>TIPS</strong></p>
<p><a target="_blank" rel="noopener" href="http://www.baidu.com/">http://www.baidu.com/</a> 不能写成 <a target="_blank" rel="noopener" href="http://www.baidu.com/">http://www.baidu.com</a> 。</p>
<p>这是因为 <a target="_blank" rel="noopener" href="http://www.baidu.com/">http://www.baidu.com</a> 不符合ab要求的 [http[s]://]hostname[:port]/path 格式要求。这是个小坑，需要注意一下。</p>
</blockquote>
<h2 id="报表解读"><a href="#报表解读" class="headerlink" title="报表解读"></a><strong>报表解读</strong></h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br></pre></td><td class="code"><pre><span class="line">➜ ab -c 10 -n 1000 http://www.baidu.com/</span><br><span class="line"></span><br><span class="line">This is ApacheBench, Version 2.3 &lt;$Revision: 1843412 $&gt;</span><br><span class="line"></span><br><span class="line">Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/</span><br><span class="line"></span><br><span class="line">Licensed to The Apache Software Foundation, http://www.apache.org/</span><br><span class="line"></span><br><span class="line">Benchmarking www.baidu.com (be patient)</span><br><span class="line"></span><br><span class="line">Completed 100 requests</span><br><span class="line"></span><br><span class="line">Completed 200 requests</span><br><span class="line"></span><br><span class="line">Completed 300 requests</span><br><span class="line"></span><br><span class="line">Completed 400 requests</span><br><span class="line"></span><br><span class="line">Completed 500 requests</span><br><span class="line"></span><br><span class="line">Completed 600 requests</span><br><span class="line"></span><br><span class="line">Completed 700 requests</span><br><span class="line"></span><br><span class="line">Completed 800 requests</span><br><span class="line"></span><br><span class="line">Completed 900 requests</span><br><span class="line"></span><br><span class="line">Completed 1000 requests</span><br><span class="line"></span><br><span class="line">Finished 1000 requests</span><br><span class="line"></span><br><span class="line"><span class="meta">#</span><span class="bash"> 展示测试地址所使用的服务器软件及版本</span></span><br><span class="line">Server Software:    BWS/1.1</span><br><span class="line"><span class="meta">#</span><span class="bash"> 测试地址的主机名</span></span><br><span class="line">Server Hostname:    www.baidu.com</span><br><span class="line"><span class="meta">#</span><span class="bash"> 测试地址的端口</span></span><br><span class="line">Server Port:      80</span><br><span class="line"><span class="meta">#</span><span class="bash"> 测试地址的路径</span></span><br><span class="line">Document Path:     /</span><br><span class="line"><span class="meta">#</span><span class="bash"> 测试地址的文档大小</span></span><br><span class="line">Document Length:    255598 bytes</span><br><span class="line"><span class="meta">#</span><span class="bash"> 并发数</span></span><br><span class="line">Concurrency Level:   10</span><br><span class="line"><span class="meta">#</span><span class="bash"> 测试花费了多久</span></span><br><span class="line">Time taken for tests:  81.881 seconds</span><br><span class="line"><span class="meta">#</span><span class="bash"> 测试总共请求了多少次</span></span><br><span class="line">Complete requests:   1000</span><br><span class="line"><span class="meta">#</span><span class="bash"> 失败的请求数</span></span><br><span class="line">Failed requests:    979</span><br><span class="line"></span><br><span class="line">  (Connect: 0, Receive: 0, Length: 979, Exceptions: 0)</span><br><span class="line"></span><br><span class="line"><span class="meta">#</span><span class="bash"> 传输的总数据量</span></span><br><span class="line">Total transferred:   256761473 bytes</span><br><span class="line"></span><br><span class="line"><span class="meta">#</span><span class="bash"> HTML文档的总数据量</span></span><br><span class="line">HTML transferred:    255605512 bytes</span><br><span class="line"></span><br><span class="line"><span class="meta">#</span><span class="bash"> 平均每秒的请求数，也叫RPS，该值越大表示服务器吞吐量越大，性能表现越好</span></span><br><span class="line">Requests per second:  12.21 [#/sec] (mean)</span><br><span class="line"></span><br><span class="line"><span class="meta">#</span><span class="bash"> 请求平均耗时，越小说明响应越快</span></span><br><span class="line">Time per request:    818.815 [ms] (mean)</span><br><span class="line"></span><br><span class="line"><span class="meta">#</span><span class="bash"> 服务器平均处理时间，其实是服务器吞吐量的倒数</span></span><br><span class="line">Time per request:    81.881 [ms] (mean, across all concurrent requests)</span><br><span class="line"></span><br><span class="line"><span class="meta">#</span><span class="bash"> 每秒获取的数据长度，单位单位：KB/s</span></span><br><span class="line">Transfer rate:     3062.28 [Kbytes/sec] received</span><br><span class="line"></span><br><span class="line"><span class="meta">#</span><span class="bash"> 连接时间统计信息</span></span><br><span class="line">Connection Times (ms)</span><br><span class="line"></span><br><span class="line"><span class="meta">#</span><span class="bash">       最小 平均     中值  最大</span></span><br><span class="line"></span><br><span class="line">​       min mean[+/-sd] median  max</span><br><span class="line"></span><br><span class="line"><span class="meta">#</span><span class="bash"> 连接时间</span></span><br><span class="line">Connect:    17 154 118.0  135  1416</span><br><span class="line"><span class="meta">#</span><span class="bash"> 处理时间</span></span><br><span class="line">Processing:  329 661 211.2  602  1824</span><br><span class="line"><span class="meta">#</span><span class="bash"> 等待时间</span></span><br><span class="line">Waiting:    22 160 88.4  143  1089</span><br><span class="line"><span class="meta">#</span><span class="bash"> 总计时间</span></span><br><span class="line">Total:    391 816 263.4  731  2521</span><br><span class="line"></span><br><span class="line"><span class="meta">#</span><span class="bash"> 请求耗时的统计信息。例如请求经过排序后，50百分位的请求花费了731毫秒；99百分位的请求花费了1942毫秒等</span></span><br><span class="line">Percentage of the requests served within a certain time (ms)</span><br><span class="line"></span><br><span class="line"><span class="meta"> 50%</span><span class="bash">  731</span></span><br><span class="line"></span><br><span class="line"><span class="meta"> 66%</span><span class="bash">  804</span></span><br><span class="line"></span><br><span class="line"><span class="meta"> 75%</span><span class="bash">  873</span></span><br><span class="line"></span><br><span class="line"><span class="meta"> 80%</span><span class="bash">  943</span></span><br><span class="line"></span><br><span class="line"><span class="meta"> 90%</span><span class="bash">  1154</span></span><br><span class="line"></span><br><span class="line"><span class="meta"> 95%</span><span class="bash">  1332</span></span><br><span class="line"></span><br><span class="line"><span class="meta"> 98%</span><span class="bash">  1726</span></span><br><span class="line"></span><br><span class="line"><span class="meta"> 99%</span><span class="bash">  1942</span></span><br><span class="line"></span><br><span class="line"><span class="meta">100%</span><span class="bash">  2521 (longest request)</span></span><br></pre></td></tr></table></figure>
    </div>

    
    
    

    <footer class="post-footer">

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/2021/08/01/docs/pool/%E5%AF%B9%E8%B1%A1%E6%B1%A0%E5%AE%9E%E6%88%98-%E7%BC%96%E5%86%99%E4%B8%80%E4%B8%AA%E6%95%B0%E6%8D%AE%E5%BA%93%E8%BF%9E%E6%8E%A5%E6%B1%A0/" rel="prev" title="对象池实战-编写一个数据库连接池">
                  <i class="fa fa-chevron-left"></i> 对象池实战-编写一个数据库连接池
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/2021/08/04/%E7%BA%BF%E7%A8%8B%E6%B1%A0ThreadPoolExecutor/" rel="next" title="线程池ThreadPoolExecutor">
                  线程池ThreadPoolExecutor <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>







<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      const activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      const commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>
</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


<div class="copyright">
  &copy; 
  <span itemprop="copyrightYear">2022</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">一年春又来</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/mist/" class="theme-link" rel="noopener" target="_blank">NexT.Mist</a> 强力驱动
  </div>

    </div>
  </footer>

  
  <script src="https://cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js"></script>
<script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/schemes/muse.js"></script><script src="/js/next-boot.js"></script>

  
<script src="/js/local-search.js"></script>






  





</body>
</html>
